﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Roguelike
{
    // Move means moving the player (or navigating a menu once I implement menus)
    // Action is any other action, like interacting with an object or opening a menu
    public enum inputType { move, action }

    // Currently only has movement inputs because action and menu aren't implemented yet
    public enum input { up, down, left, right }

    public class InputManager
    {
        // Relates the character of the key pressed to the input information associated with that key
        public Dictionary<char, InputInfo> inputs;

        /// <summary>
        /// Constructor for InputManager
        /// </summary>
        public InputManager()
        {
            inputs = new Dictionary<char, InputInfo>();
            InitializeInputs();
        }

        /// <summary>
        /// Initializes inputs dictionary
        /// </summary>
        private void InitializeInputs()
        {
            inputs.Add('w', new InputInfo(inputType.move, input.up));
            inputs.Add('a', new InputInfo(inputType.move, input.left));
            inputs.Add('s', new InputInfo(inputType.move, input.down));
            inputs.Add('d', new InputInfo(inputType.move, input.right));
        }

        public bool TestValidInputKey(char keyPressed)
        {
            if (inputs.ContainsKey(keyPressed) == true)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public InputInfo GetInput(char keyPressed)
        {
            return inputs[keyPressed];
        }
    }
}
